﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BG.Web.Admin.RoomStatus.Default" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
    .indicator{width:150px;color:Gray;}
    .must-input{color:Red;}
    .search-item {font: normal 11px tahoma, arial, helvetica, sans-serif;padding: 3px 10px 3px 10px;border: 1px solid #fff;border-bottom : 1px solid #eeeeee;white-space: normal;color:#555;}
    .search-item h3 {display: block;font: inherit;font-weight : bold;color:#222;}
    .search-item h3 span {float:right;font-weight:normal;margin:0 0 5px 5px;width:30px;display:block;clear:none;} 
    /*.search-item .address{width:100%;}*/
    p{width:650px;}
    .ext-ie .x-form-text{ position:static !important;}
    .x-form-item-label{font-weight:bold;}
    #btnFinalPrice .x-btn-text{font-weight:bold;color:Red;}
    </style>
</head>
<body>
    <script type="text/javascript" src="../Kwan.Base.js"></script>
    <script type="text/javascript" src="Kwan.RoomStatus.js"></script>
    <link rel="Stylesheet" href="../resources/Kwan.Base.css" />
    <link rel="Stylesheet" href="../resources/Kwan.icon.css" />
    <form id="Form2" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="RoomStatus" />
        <ext:Store ID="ConsumeDS" runat="server" OnSubmitData="SubmitConsumeDS">
            <Reader>
                <ext:JsonReader IDProperty="EntityID">
                    <Fields>
                        <ext:RecordField Name="EntityID" />
						<ext:RecordField Name="CreatedDate" />
						<ext:RecordField Name="Item" />
						<ext:RecordField Name="Nett" />
						<ext:RecordField Name="OrderID" />
                        <ext:RecordField Name="ProductID" />
						<ext:RecordField Name="Price" />
						<ext:RecordField Name="Receivable" />
						<ext:RecordField Name="RoomNO" />
						<ext:RecordField Name="Status" />
						<ext:RecordField Name="Total" />
						<ext:RecordField Name="Type" />
						<ext:RecordField Name="UserID" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:Store ID="ProductDS1" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="EntityID">
                    <Fields>
                        <ext:RecordField Name="EntityID" />
                        <ext:RecordField Name="Cid" />
						<ext:RecordField Name="NameCN" />
						<ext:RecordField Name="Price" />
                        <ext:RecordField Name="Count" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:Store ID="RoomDS1" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="EntityID">
                    <Fields>
                        <ext:RecordField Name="EntityID" />
                        <ext:RecordField Name="RoomNO" />
                        <ext:RecordField Name="ClassName" />
						<ext:RecordField Name="ClassPrice" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

        <ext:Store ID="roomStore" runat="server" OnRefreshData="RefreshRoomDS" RemoteSort="True">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="Title" />
                        <ext:RecordField Name="Items" IsComplex="true" />         
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

        <ext:Store ID="CustomerDS" runat="server" OnRefreshData="RefreshCustomerDS" AutoLoad="false">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="NameCN" />
                        <ext:RecordField Name="Sex" />
                        <ext:RecordField Name="Address" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

        <ext:Viewport runat="server" Layout="FitLayout">
        <Items>
        <ext:Panel ID="Panel1" runat="server" Cls="items-view" Layout="fit" AutoScroll="true" Border="false">
            <%--<TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server" Flat="true">
                    <Items>
                        <ext:ToolbarFill />
                        <ext:Button runat="server" Icon="BulletPlus" Text="展开所有">
                            <Listeners>
                                <Click Handler="#{dvRoom}.el.select('.group-header').removeClass('collapsed');" />
                            </Listeners>
                        </ext:Button>
                        
                        <ext:Button runat="server" Icon="BulletMinus" Text="关闭所有">
                                <Listeners>
                                <Click Handler="#{dvRoom}.el.select('.group-header').addClass('collapsed');" />
                            </Listeners>
                        </ext:Button>
                        <ext:ToolbarSpacer runat="server" Width="30" />
                    </Items>
                </ext:Toolbar>
            </TopBar>--%>
            <Items>
            <ext:DataView ID="dvRoom" runat="server" StoreID="roomStore" SingleSelect="true" OverClass="x-view-over" ItemSelector="div.item-wrap"  EmptyText="<div style='width:100px;margin:200px 480px;font-size:14px;color:red;font-weight:700;'>没房间了！</div>">
                <Template ID="Template2" runat="server">
                    <Html>
                        <div id="items-ct">
							<tpl for=".">
								<%--<div class="group-header">
									<h2><div>{Title} 楼</div></h2>--%>
									<dl>
										<tpl for="Items">
                                            <tpl if="Status=='空洁房'">
											<div id="{Id}" class="item-wrap item-wrap-room clean-room">
                                            </tpl>
                                            <tpl if="Status=='空脏房'">
                                            <div id="{Id}" class="item-wrap item-wrap-room dirty-room">
                                            </tpl>
                                            <tpl if="Status=='住客房'">
                                            <div id="{Id}" class="item-wrap item-wrap-room checkin-room">
                                            </tpl>
                                            <tpl if="Status=='维修房'">
                                            <div id="{Id}" class="item-wrap item-wrap-room broken-room">
                                            </tpl>
                                            <tpl if="Status=='保留房'">
                                            <div id="{Id}" class="item-wrap item-wrap-room keeping-room">
                                            </tpl>
												<%--<img src="{Icon}"/>--%>
												<div><H6>{Title}</H6></div>
                                                <div class="room-price">{Price}元</div>
                                                <%--<div class="room-type">{Type}</div>--%>
                                                <div class="room-type">{Status}</div>
                                                <div class="room-other">
                                                <tpl if="IsComputer==true"><div class="room-computer"></div></tpl>
                                                <tpl if="IsMaQue==true"><div class="room-maque"></div></tpl>
                                                </div>
											</div>
										</tpl>
										<div style="clear:left"></div>
										</dl>
								<%--</div>--%>
							</tpl>
						</div>
					</Html>
                </Template>
                <Listeners>
                    <ContainerClick Fn="Kwan.blankClick" />
                    <SelectionChange Fn="Kwan.roomClick" />
                    <ContextMenu Fn="Kwan.rightClick" Scope="this" />
                </Listeners>
            </ext:DataView>
            <ext:Menu ID="RoomContextMenu" runat="server" EnableScrolling="true">
                <Items>
                    <ext:MenuItem ID="miCheckIn" runat="server" Text="入住" Icon="Add" />
                    <ext:MenuSeparator />
                    <ext:MenuItem ID="miCheckOut" runat="server" Text="结账" Icon="Add" />
                    <ext:MenuSeparator />
                    <ext:MenuItem ID="miChangeRoom" runat="server" Text="换房" Icon="Add" />
                    <ext:MenuItem ID="miEditDeposit" runat="server" Text="修改押金" Icon="Add" />
                    <ext:MenuSeparator />
                    <ext:MenuItem ID="miCleanRoom" runat="server" Text="设为空洁房" Icon="Pencil" />
                    <ext:MenuItem ID="miDirtyRoom" runat="server" Text="设为空脏房" Icon="Delete" />
                    <ext:MenuItem ID="miBroken" runat="server" Text="设为维修房" Icon="Delete" />
                </Items>
                <Listeners>
                    <ItemClick Handler="Kwan.ContextMenuClick(#{dvRoom},menuItem.id);" />
                </Listeners>
            </ext:Menu>
            </Items>
        </ext:Panel>
        <ext:Window ID="winCheckIN" runat="server" Icon="Group" Title="登记入住" AutoShow="false" Modal="true" Width="800" Height="550" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="90" AnimateTarget="btnCheckIN">
            <TopBar>
                <ext:Toolbar ID="tbCheckIN" runat="server">
                    <Items>
                        <ext:ButtonGroup ID="bgRoomNO" runat="server" Title="房间号"><Items><ext:Button ID="txtRoomNO" Width="123" runat="server" /></Items></ext:ButtonGroup>
                        <ext:ButtonGroup ID="bgRoomClass" runat="server" Title="房间类型"><Items><ext:Button ID="txtRoomClass" Width="123" runat="server" /></Items></ext:ButtonGroup>
                        <ext:ButtonGroup ID="bgCardNO" runat="server" Title="卡号"><Items><ext:Button ID="txtCardNo" Width="123" runat="server" /></Items></ext:ButtonGroup>
                        <ext:ToolbarFill />
                        <ext:ButtonGroup ID="bgCheckInDate" runat="server" Title="入住时间"><Items><ext:Button ID="btnCheckInDate" Width="123" runat="server" /></Items></ext:ButtonGroup>
                        <ext:ButtonGroup ID="bgFinalPrice" runat="server" Title="房间费用"><Items><ext:Button ID="btnFinalPrice" Width="123" runat="server" /></Items></ext:ButtonGroup>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <Items>
            <ext:TabPanel runat="server" ActiveTabIndex="0" Border="false" DeferredRender="false">
            <Items>
                <ext:FormPanel ID="fpCheckIN" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="5" Layout="Form" LabelAlign="Right" LabelWidth="70" MonitorResize="true" Title="订单信息">
                    <Items>
                        <ext:Hidden ID="txtRoomID" runat="server" />
                        <ext:Hidden ID="txtOrderID" runat="server" />
                        <ext:FieldSet runat="server" Padding="5" Layout="form" Title="订单信息">
                        <Items>
                        <ext:Container runat="server" Layout="Column" Height="150" AnchorHorizontal="99%">
                        <Items>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".33">
                        <Items>
                            <ext:SpinnerField ID="txtDays" LabelStyle="color:red;"  FieldLabel="预住天数" AllowBlank="false" runat="server" MinValue="1" />
                            <ext:NumberField ID="txtDeposit" LabelStyle="color:red;" FieldLabel="实际押金" runat="server" AllowBlank="false" />
                            <ext:NumberField ID="txtRoomPrice" LabelStyle="color:red;" FieldLabel="预住房价" runat="server" AllowBlank="false" />
                            <ext:NumberField Hidden="true" ID="txtDisCount" LabelStyle="color:red;" FieldLabel="打折比例" AnchorHorizontal="50%" runat="server" Text="100" AllowBlank="false" />
                            <ext:RadioGroup ID="rgCheckInType" ColumnsNumber="2" runat="server" FieldLabel="预住类型" AnchorHorizontal="98%">
                                <Items>
                                    <ext:Radio ID="rdoCheckInType3" runat="server" BoxLabel="全天房" Checked="true" />
                                    <ext:Radio ID="rdoCheckInType1" runat="server" BoxLabel="钟点房" />
                                    <ext:Radio ID="rdoCheckInType2" runat="server" BoxLabel="半天房" />
                                    <%--<ext:Radio ID="rdoCheckInType0" runat="server" BoxLabel="免收" />--%>
                                </Items>
                                <Listeners>
                                    <Change Handler="RoomStatus.ChangeRoomPrice(this.readOnly)" />
                                </Listeners>
                            </ext:RadioGroup>
                        </Items>
                        </ext:Container>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".69">
                        <Items>
                 <ext:ColumnLayout runat="server" FitHeight="true">
                    <Columns>
                        <ext:LayoutColumn ColumnWidth="0.5">
                           <ext:GridPanel ID="gpRoom1" Title="可合并结账的房间" runat="server" EnableDragDrop="false" ColumnLines="True" AutoExpandColumn="RoomNO" StoreID="RoomDS1">
                                <ColumnModel>
	                                <Columns>
                                        <ext:Column Header="房号" DataIndex="RoomNO" />
                                        <ext:Column Header="类别" DataIndex="ClassName" Width="80" />
                                        <ext:Column Header="单价" DataIndex="ClassPrice" Width="50" />
	                                </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel runat="server" />
                                </SelectionModel> 
                                <Plugins>
                                    <ext:GridFilters ID="GridFilters1" runat="server" Local="true">
                                        <Filters>
                                            <ext:StringFilter DataIndex="RoomNO" />
                                        </Filters>
                                    </ext:GridFilters>
                                </Plugins> 
                            </ext:GridPanel>
                        </ext:LayoutColumn>
                        <ext:LayoutColumn>
                            <ext:Panel runat="server" Width="35" BodyStyle="background-color: transparent;" Border="false" Layout="Anchor">
                                <Items>
                                    <ext:Panel runat="server" Border="false" BodyStyle="background-color: transparent;" AnchorVertical="40%" />
                                    <ext:Panel runat="server" Border="false" BodyStyle="background-color: transparent;" Padding="5">
                                        <Items>
                                            <ext:Button runat="server" Icon="ResultsetNext" StyleSpec="margin-top:40px;margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.add(gpRoom1,gpRoom2);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="增加所选项" />
                                                </ToolTips>
                                            </ext:Button>
                                            <%--<ext:Button ID="Button3" runat="server" Icon="ResultsetLast" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.addAll();" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip ID="ToolTip2" runat="server" Title="Add all" Html="Add all rows" />
                                                </ToolTips>
                                            </ext:Button>--%>
                                            <ext:Button runat="server" Icon="ResultsetPrevious" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.remove(gpRoom1,gpRoom2);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="移除所选项" />
                                                </ToolTips>
                                            </ext:Button>
                                            <ext:Button ID="Button6" runat="server" Icon="ResultsetFirst" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.removeAll(gpRoom1,gpRoom2);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="移除所有项" />
                                                </ToolTips>
                                            </ext:Button>
                                        </Items>
                                    </ext:Panel>
                                </Items>
                            </ext:Panel>
                        </ext:LayoutColumn>
                        <ext:LayoutColumn ColumnWidth="0.8">
                            <ext:GridPanel ID="gpRoom2" Title="已合并结账的房间" runat="server" EnableDragDrop="false" ColumnLines="True" AutoExpandColumn="RoomNO">
                                <Store>
                                    <ext:Store ID="RoomDS2" runat="server" OnSubmitData="SubmitRoomDS2">
                                        <Reader>
                                            <ext:JsonReader IDProperty="EntityID">
                                                <Fields>
                                                    <ext:RecordField Name="EntityID" />
                                                    <ext:RecordField Name="RoomNO" />
                                                    <ext:RecordField Name="ClassName" />
						                            <ext:RecordField Name="ClassPrice" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Store>
                                <ColumnModel runat="server">
	                                <Columns>
                                        <ext:Column Header="房号" DataIndex="RoomNO" />
                                        <ext:Column Header="类别" DataIndex="ClassName" Width="80" />
                                        <ext:Column Header="单价" DataIndex="ClassPrice" Width="60">
                                            <Editor>
                                                <ext:TextField runat="server" />
                                            </Editor>
                                        </ext:Column>
	                                </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" />
                                </SelectionModel>  
                                <SaveMask ShowMask="true" />
                            </ext:GridPanel>
                        </ext:LayoutColumn>
                    </Columns>
                </ext:ColumnLayout>
                        </Items>
                        </ext:Container>
                        </Items>
                        </ext:Container>
                        </Items>
                        </ext:FieldSet>
                        <ext:FieldSet ID="FieldSet3" runat="server" Padding="5" Layout="form" Title="宾客信息">
                        <Items>
                            <ext:ComboBox ID="txtCustomerName" Editable="true" FieldLabel="姓名" runat="server" DisplayField="NameCN" ValueField="NameCN" LoadingText="Searching..." StoreID="CustomerDS" HideTrigger="true" MinChars="1" Width="130" PageSize="10" ItemSelector="div.search-item" AnchorHorizontal="42%" IndicatorCls="indicator" IndicatorText="输入姓名可进行模糊查询">
                                <Template ID="Template1" runat="server">
                                   <Html>
					                   <tpl for=".">
						                  <div class="search-item">
							                 <h3><span><tpl if="Sex==1">男</tpl><tpl if="Sex==0">女</tpl></span>
                                                {NameCN}
                                             </h3>
							                 <div class="address">{Address}</div>
						                  </div>
					                   </tpl>
				                   </Html>
                                </Template>
                                <Listeners>
                                    <BeforeQuery Handler="Kwan.customerName=this.getRawValue();" />
                                    <Blur Handler="this.setRawValue(Kwan.customerName);" />
                                    <Select Handler="Kwan.customerName=this.getValue();RoomStatus.SetCustomer(this.getValue());" />
                                </Listeners>
                            </ext:ComboBox>
                        <ext:Container runat="server" Layout="Column" Height="80" AnchorHorizontal="99%">
                        <Items>

                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".33">
                        <Items>
                            <ext:ComboBox ID="txtIDType" runat="server" FieldLabel="证件类型" AnchorHorizontal="98%">
                                <Items>
                                    <ext:ListItem Text="居民身份证" Value="1" />
                                    <ext:ListItem Text="临时身份证" Value="2" />
                                    <ext:ListItem Text="军官证" Value="3" />
                                    <ext:ListItem Text="护照" Value="4" />
                                    <ext:ListItem Text="港澳同胞回乡证" Value="5" />
                                    <ext:ListItem Text="外国人出入境证" Value="6" />
                                    <ext:ListItem Text="外国人居留证" Value="7" />
                                </Items>
                                <SelectedItem Value="1" />
                            </ext:ComboBox>
                            <ext:TextField ID="txtPhone" FieldLabel="联系电话" runat="server" AnchorHorizontal="98%" />
                            <ext:TextField ID="txtCountry" FieldLabel="国籍" runat="server" AnchorHorizontal="98%" />
                        </Items>
                        </ext:Container>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".33">
                        <Items>
                            <ext:ComboBox ID="txtSex" Editable="false" runat="server" FieldLabel="性别" AnchorHorizontal="98%">
                                <Items>
                                    <ext:ListItem Text="男" Value="1" />
                                    <ext:ListItem Text="女" Value="0" />
                                </Items>
                                <SelectedItem Value="1" />
                            </ext:ComboBox>
                            <ext:TextField ID="txtIDNO" runat="server" FieldLabel="证件号码" AnchorHorizontal="98%" />
                            <ext:ComboBox ID="txtLevel" runat="server" FieldLabel="宾客类型" AnchorHorizontal="98%">
                                <Items>
                                    <ext:ListItem Text="普通宾客" Value="0" />
                                    <ext:ListItem Text="VIP宾客" Value="1" />
                                    <ext:ListItem Text="协议宾客" Value="2" />
                                </Items>
                            </ext:ComboBox>

                        </Items>
                        </ext:Container>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".33">
                        <Items>
                            <ext:Panel runat="server" Padding="20" Html="如果需要登记宾客信息，请输入姓名。如果姓名为空，将无法保存客人信息！" BodyBorder="False"></ext:Panel>
                        </Items>
                        </ext:Container>
                        </Items>
                        </ext:Container>
                        <ext:TextField ID="txtAddress" FieldLabel="地址" runat="server" AnchorHorizontal="80%" />
                        <ext:TextField ID="txtCustomerMemo" FieldLabel="备注" runat="server" AnchorHorizontal="80%" />
                        </Items>
                        </ext:FieldSet>
                    </Items>
                    <Listeners>
                        <ClientValidation Handler="#{btnSaveCheckIN}.setDisabled(!valid);#{btnCheckOut}.setDisabled(!valid);" />
                    </Listeners>
                </ext:FormPanel>
                <ext:Panel ID="fpProduct" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="5" Layout="Form" LabelAlign="Right" LabelWidth="70" MonitorResize="true" Title="消费列表">
                    <Items>
                <ext:ColumnLayout runat="server" FitHeight="true">
                    <Columns>
                        <ext:LayoutColumn ColumnWidth="0.4">
                           <ext:GridPanel ID="gpProduct1" runat="server" EnableDragDrop="false" ColumnLines="True" AutoExpandColumn="NameCN" StoreID="ProductDS1">
                                <ColumnModel>
	                                <Columns>
                                        <ext:Column ColumnID="NameCN" Header="项目名称" DataIndex="NameCN" />
                                        <ext:Column ColumnID="Price" Header="单价" DataIndex="Price" Width="40" /> 
	                                </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
                                </SelectionModel> 
                                <Plugins>
                                    <ext:GridFilters runat="server" Local="true">
                                        <Filters>
                                            <ext:StringFilter DataIndex="NameCN" />
                                        </Filters>
                                    </ext:GridFilters>
                                </Plugins> 
                            </ext:GridPanel>
                        </ext:LayoutColumn>
                        <ext:LayoutColumn>
                            <ext:Panel runat="server" Width="35" BodyStyle="background-color: transparent;" Border="false" Layout="Anchor">
                                <Items>
                                    <ext:Panel runat="server" Border="false" BodyStyle="background-color: transparent;" AnchorVertical="40%" />
                                    <ext:Panel runat="server" Border="false" BodyStyle="background-color: transparent;" Padding="5">
                                        <Items>
                                            <ext:Button runat="server" Icon="ResultsetNext" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.addPro(gpProduct1, gpConsume);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="增加所选项" />
                                                </ToolTips>
                                            </ext:Button>
                                            <%--<ext:Button ID="Button3" runat="server" Icon="ResultsetLast" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.addAll();" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip ID="ToolTip2" runat="server" Title="Add all" Html="Add all rows" />
                                                </ToolTips>
                                            </ext:Button>--%>
                                            <ext:Button runat="server" Icon="ResultsetPrevious" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.remove(gpProduct1, gpConsume);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="移除所选项" />
                                                </ToolTips>
                                            </ext:Button>
                                            <ext:Button ID="Button5" runat="server" Icon="ResultsetFirst" StyleSpec="margin-bottom:2px;">
                                                <Listeners>
                                                    <Click Handler="Kwan.removeAll(gpProduct1, gpConsume);" />
                                                </Listeners>
                                                <ToolTips>
                                                    <ext:ToolTip Title="移除所有项" />
                                                </ToolTips>
                                            </ext:Button>
                                        </Items>
                                    </ext:Panel>
                                </Items>
                            </ext:Panel>
                        </ext:LayoutColumn>
                        <ext:LayoutColumn ColumnWidth="0.8">
                            <ext:GridPanel ID="gpConsume" runat="server" EnableDragDrop="false" ColumnLines="True" AutoExpandColumn="Item" StoreID="ConsumeDS">
                                <ColumnModel runat="server">
	                                <Columns>
                                        <ext:Column ColumnID="Item" Header="项目名称" DataIndex="Item" />
                                        <ext:Column ColumnID="Price" Header="单价" DataIndex="Price" Width="50" />
                                        <ext:Column ColumnID="Total" Header="数量" DataIndex="Total" Width="60">
                                            <Editor>
                                                <ext:SpinnerField runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:GroupingSummaryColumn Header="总价" Align="Right" ColumnID="Total" DataIndex="Total" SummaryType="Sum">
                                                <Renderer Handler="return Ext.util.Format.usMoney(record.data.Price * record.data.Total);" />
                                        </ext:GroupingSummaryColumn>
	                                </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" />
                                </SelectionModel>  
                                <SaveMask ShowMask="true" />
                            </ext:GridPanel>
                        </ext:LayoutColumn>
                    </Columns>
                </ext:ColumnLayout>

                    </Items>
                    <Buttons>
                        <ext:Button ID="btnProduct" runat="server" Text="保存消费" Icon="PictureEmpty">
                            <Listeners>
                                <Click Handler="Kwan.submitPro(#{gpConsume});" />
                            </Listeners>
                        </ext:Button>
                    </Buttons>
                </ext:Panel>
            </Items>
            </ext:TabPanel>
            </Items>
            <Buttons>
                <ext:Button ID="btnReadCard" runat="server" Text="读卡" Icon="PictureEmpty">
                    <Listeners>
                        <Click Handler="Default.RoomClick(#{txtRoomID}.getValue());" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnFreeOrder" runat="server" Icon="MoneyDelete" Text="免收并退房">
                    <Listeners>
                        <Click Handler="Kwan.freeOrder()" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnCheckOut" runat="server" Icon="MoneyDollar" Text="结账">
                    <Listeners>
                        <Click Handler="RoomStatus.ShowCheckOut(#{btnFinalPrice}.text,#{gpConsume}.getRowsValues())" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnSaveCheckIN" runat="server" Icon="DoorIn" Text="登记入住">
                    <Listeners>
                        <Click Handler="RoomStatus.SaveCheckIN(Kwan.customerName,#{gpConsume}.getRowsValues(),#{gpRoom2}.getRowsValues())" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Text="返回" Icon="Cancel">
                    <Listeners>
                        <Click Handler="#{TaskManager1}.startTask(0);#{winCheckIN}.hide();" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        <ext:Window ID="winCollectDP" runat="server" Icon="Group" Title="押金收款" AutoShow="false" Modal="true" Width="600" Height="400" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="90" AnimateTarget="btnCheckIN">
            <Items>
                <ext:FormPanel MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="30" Layout="RowLayout" LabelAlign="Right" LabelWidth="80" MonitorResize="true">
                    <Items>
                        <ext:Label ID="Label1" runat="server" />
                        <ext:Hidden ID="txtDPOrderID" runat="server" />
                        <ext:Container runat="server" Layout="Column" Height="110" AnchorHorizontal="99%">
                        <Items>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                        <Items>
                            <ext:TextField ID="txtDPReceivable" LabelStyle="color:red;" ReadOnly="true" FieldLabel="应收金额" runat="server" AnchorHorizontal="98%" />
                            <ext:TextField ID="txtDPMemo" FieldLabel="备注" runat="server" AnchorHorizontal="98%" />
                        </Items>
                        </ext:Container>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                        <Items>
                            <ext:TextField ID="txtDPCashPay" LabelStyle="color:red;" FieldLabel="现金支付" AnchorHorizontal="98%" runat="server" EnableKeyEvents="true" AllowBlank="false">
                                <Listeners>
                                    <KeyUp Handler="Kwan.changePay(this.getValue(),#{txtDPPosPay}.getValue(),#{txtDPReceivable}.getValue(),#{txtDPChange});" />
                                </Listeners>
                            </ext:TextField>
                            <ext:TextField ID="txtDPPosPay" LabelStyle="color:red;" FieldLabel="银行卡支付" AnchorHorizontal="98%" runat="server" EnableKeyEvents="true" AllowBlank="false">
                                <Listeners>
                                    <KeyUp Handler="Kwan.changePay(#{txtDPCashPay}.getValue(),this.getValue(),#{txtDPReceivable}.getValue(),#{txtDPChange});" />
                                </Listeners>
                            </ext:TextField>
                            <ext:TextField ID="txtDPChange" LabelStyle="color:red;" ReadOnly="true" FieldLabel="找零" AnchorHorizontal="98%" runat="server" />
                        </Items>
                        </ext:Container>
                        </Items>
                        </ext:Container>
                    </Items>
                    <Listeners>
                        <ClientValidation Handler="#{btnCollectDP}.setDisabled(!valid);
                        if (!valid && txtDPCashPay.getValue() == '' ) {txtDPCashPay.focus();return false; }" />
                    </Listeners>
                </ext:FormPanel>
            </Items>  
            <Buttons>
                <ext:Button ID="btnCollectDP" runat="server" Text="收款" Icon="MoneyAdd">
                    <Listeners>
                        <Click Handler="RoomStatus.SaveDeposit();" />
                    </Listeners>
                </ext:Button>
                <ext:Button runat="server" Text="返回" Icon="Cancel">
                    <Listeners>
                        <Click Handler="#{winCollectDP}.hide()" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        <ext:Window ID="winCheckOut" runat="server" Icon="Group" Title="结账收款" AutoShow="false" Modal="true" Width="600" Height="400" Collapsible="true" Hidden="true" Layout="Fit" LabelWidth="90" AnimateTarget="btnCheckIN">
            <Items>
                <ext:FormPanel ID="fpCheckOut" MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="30" Layout="RowLayout" LabelAlign="Right" LabelWidth="80" MonitorResize="true">
                    <Items>
                        <ext:Label ID="lbCheckInDays" runat="server" />
                        <ext:Container runat="server" Layout="Column" Height="110" AnchorHorizontal="99%">
                        <Items>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                        <Items>
                            <ext:TextField ID="txtReceivable" LabelStyle="color:red;" ReadOnly="true" FieldLabel="应收金额" runat="server" AnchorHorizontal="98%" />
                            <ext:TextField ID="txtPayDeposit" LabelStyle="color:red;" ReadOnly="true" FieldLabel="已收押金" runat="server" AnchorHorizontal="98%" />
                            <ext:TextField ID="txtPayDisCount" LabelStyle="color:red;" ReadOnly="true" FieldLabel="优惠金额" runat="server" AnchorHorizontal="98%" />
                            <ext:TextField ID="txtMemo" FieldLabel="备注" runat="server" AnchorHorizontal="98%" />
                        </Items>
                        </ext:Container>
                        <ext:Container runat="server" LabelAlign="Left" Layout="Form" ColumnWidth=".5">
                        <Items>
                            <ext:TriggerField ID="txtPaid" Editable="false" LabelStyle="color:red;" FieldLabel="实收金额" AnchorHorizontal="98%" runat="server">
                                <Listeners><TriggerClick Handler="if(index == 0){ this.setValue(parseInt(this.getValue())) }" /></Listeners>
                                <Triggers><ext:FieldTrigger Icon="Clear" Qtip="抹零"/></Triggers>
                            </ext:TriggerField>
                            <ext:TextField ID="txtCashPay" LabelStyle="color:red;" FieldLabel="现金支付" AnchorHorizontal="98%" runat="server" EnableKeyEvents="true" AllowBlank="false">
                                <Listeners>
                                    <KeyUp Handler="Kwan.changePay(this.getValue(),#{txtPosPay}.getValue(),#{txtPaid}.getValue(),#{txtChange});" />
                                </Listeners>
                            </ext:TextField>
                            <ext:TextField ID="txtPosPay" LabelStyle="color:red;" FieldLabel="银行卡支付" AnchorHorizontal="98%" runat="server" EnableKeyEvents="true" AllowBlank="false">
                                <Listeners>
                                    <KeyUp Handler="Kwan.changePay(#{txtCashPay}.getValue(),this.getValue(),#{txtPaid}.getValue(),#{txtChange});" />
                                </Listeners>
                            </ext:TextField>
                            <ext:TextField ID="txtChange" LabelStyle="color:red;" ReadOnly="true" FieldLabel="找零" AnchorHorizontal="98%" runat="server" />
                        </Items>
                        </ext:Container>
                        </Items>
                        </ext:Container>

                            <%--<ext:GridPanel ID="GridPanel1" Title="消费项目" StoreID="ConsumeDS" runat="server" EnableDragDrop="false" ColumnLines="True" AutoExpandColumn="NameCN" RowHeight=".4">
                                <ColumnModel runat="server">
	                                <Columns>
                                        <ext:Column ColumnID="NameCN" Header="项目名称" DataIndex="NameCN" />
                                        <ext:Column ColumnID="Price" Header="单价" DataIndex="Price" Width="50" />
                                        <ext:Column ColumnID="Count" Header="数量" DataIndex="Count" Width="60" />
                                        <ext:GroupingSummaryColumn Header="总价" Align="Right" ColumnID="TotalPrice" DataIndex="TotalPrice" SummaryType="Sum">
                                                <Renderer Handler="if(record.data.EntityID==0){return Ext.util.Format.usMoney(btnFinalPrice.text);}
                                                else{return Ext.util.Format.usMoney(record.data.Price * record.data.Count);}" />
                                        </ext:GroupingSummaryColumn>
	                                </Columns>
                                </ColumnModel>  
                                <SaveMask ShowMask="true" />
                            </ext:GridPanel>--%>
                    </Items>
                    <Listeners>
                        <ClientValidation Handler="#{btnSaveCheckOut}.setDisabled(!valid);
                        if (!valid && txtCashPay.getValue() == '' ) {txtCashPay.focus();return false; } " />
                    </Listeners>
                </ext:FormPanel>
            </Items>  
            <Buttons>
                <ext:Button ID="btnSaveCheckOut" runat="server" Text="结账" Icon="MoneyAdd">
                    <Listeners>
                        <Click Handler="RoomStatus.SaveCheckOut(btnFinalPrice.text,gpConsume.getRowsValues());" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="Button7" runat="server" Text="返回" Icon="Cancel">
                    <Listeners>
                        <Click Handler="#{winCheckOut}.hide()" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        </Items>
        </ext:Viewport>

        <ext:Window ID="winChangeRoom" runat="server" Icon="Group" Title="换房" AutoShow="false" Modal="true" Width="350" Height="150" Collapsible="true" Hidden="true" Layout="Fit" AnimateTarget="btnCheckIN">
            <Items>
                <ext:FormPanel MonitorValid="true" runat="server" Header="false" Icon="ChartOrganisation" Padding="30" Layout="RowLayout" LabelAlign="Right" LabelWidth="70" MonitorResize="true">
                    <Items>
                        <ext:DropDownField ID="txtChangeRoom" runat="server" FieldLabel="选择房间" Editable="false" AnchorHorizontal="99%" TriggerIcon="Search" Mode="ValueText" AllowBlank="False">
                            <Component>
                                <ext:TreePanel ID="TreePanel1" runat="server" Icon="Accept" Height="300" Shadow="None" UseArrows="true" AutoScroll="true" Animate="true" EnableDD="true" ContainerScroll="true" RootVisible="false">
                                <Root>
                                    <ext:AsyncTreeNode Text="Examples" NodeID="root" Expanded="true" Checked="False" />
                                </Root>
                                <Loader>
                                    <ext:PageTreeLoader RequestMethod="POST" OnNodeLoad="GetExamplesNodes" PreloadChildren="true">
                                    </ext:PageTreeLoader>
                                </Loader>

                                <SelectionSubmitConfig Encode="true" />
                                <Listeners>
                                    <Click Handler="this.dropDownField.setValue(node.id,node.attributes.text,true);" />
                                </Listeners>
                            </ext:TreePanel>
                            </Component>
                            <Listeners>
                                <Expand Handler="this.component.getRootNode().expand(true);" Single="true" Delay="10" />
                            </Listeners>
                        </ext:DropDownField>
                    </Items>
                    <Listeners>
                        <ClientValidation Handler="#{btnSaveChangeRoom}.setDisabled(!valid);" />
                    </Listeners>
                </ext:FormPanel>
            </Items>
            <Buttons>
                <ext:Button ID="btnSaveChangeRoom" runat="server" Text="确定" Icon="MoneyAdd">
                    <Listeners>
                        <Click Handler="RoomStatus.SaveChangeRoom(Kwan.selectedNodeID);" />
                    </Listeners>
                </ext:Button>
                <ext:Button runat="server" Text="返回" Icon="Cancel">
                    <Listeners>
                        <Click Handler="#{winChangeRoom}.hide()" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        <%--刷新房态表--%>
        <ext:TaskManager ID="TaskManager1" runat="server" AutoRunDelay="5000">
            <Tasks>
                <ext:Task TaskID="RefreshRoomStatus" Interval="5000">
                    <Listeners>
                        <Update Handler="roomStore.reload();" />
                    </Listeners>    
                </ext:Task>
                <%--<ext:Task TaskID="GetInternetTime" Interval="36000">
                    <Listeners>
                        <Update Handler="RoomStatus.MatchInternetTime();" />
                    </Listeners>
                </ext:Task>--%>
            </Tasks>
        </ext:TaskManager>
    </form>
</body>
</html>